package com.trust.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.trust.entity.FieldPlantLand;
import com.trust.mapper.FieldPlantLandMapper;
import com.trust.service.FieldPlantLandService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;

@Slf4j
@Service
public class FieldPlantLandServiceImpl extends ServiceImpl<FieldPlantLandMapper, FieldPlantLand> implements FieldPlantLandService {


    @Override
    public List<FieldPlantLand> getByLandId(Integer landId) {
        LambdaQueryWrapper<FieldPlantLand> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(FieldPlantLand::getLandId, landId);
        return this.list(wrapper);
    }

    @Override
    public List<FieldPlantLand> getByFieldId(Integer fieldId) {
        LambdaQueryWrapper<FieldPlantLand> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(FieldPlantLand::getFieldId, fieldId);
        return this.list(wrapper);
    }

    @Override
    public void removeByFieldId(Integer id) {
        LambdaQueryWrapper<FieldPlantLand> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(FieldPlantLand::getFieldId, id);
        this.remove(wrapper);
    }

}
